import { defineConfig } from "vite";
import { fileURLToPath, URL } from "node:url";
import uni from "@dcloudio/vite-plugin-uni";

export default defineConfig({
  disableHostCheck: true, //内网穿透时需要将属性设置成true, 否则无法正常查看 | 不内网穿透时也不影响正常访问
  plugins: [uni()],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
  proxy: {
    "/api": {
      //获取路径中包含了/api的请求
      rewrite: (path) => path.replace(/^\/api/, ""), ///api替换为''
      // target: 'http://192.168.101.6:8089',//后台服务所在的源
      target: "http://localhost:8080", //后台服务所在的源
      changeOrigin: true, //修改源
      https: false,
    },
  },
});
